package io.hilo.example.biz01.web.demo;

import java.util.Collections;
import java.util.Map;

import org.hilo.boot.core.util.Assert;
import org.jretty.apibase.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.hilo.example.biz01.common.MsgBiz01;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

/**
 * API登录授权
 */
@RestController
@RequestMapping("/api")
@Api("登录接口")
public class ApiLoginController {

    /**
     * 登录
     */
    @PostMapping("login")
    @ApiOperation(value = "登录", notes = "登录说明")
    public Result<?> login(
            @ApiParam(value = "手机号", required = true) @RequestParam String mobile,
            @ApiParam(value = "密码", required = true)   @RequestParam String password) {

        Assert.isBlank(mobile, MsgBiz01.USR_MOBILE_EMPTY);
        Assert.isBlank(password, MsgBiz01.USR_PASSWD_EMPTY);

        // 用户登录
        // userService.login(mobile, password);

        // 生成token
        Map<String, Object> map = Collections.emptyMap();

        return Result.success(map);
    }
    
}
